package com.trkj.controllers;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trkj.pojos.ExchangebedTable;
import com.trkj.service.BulidService;
import com.trkj.service.SickroomService;
import com.trkj.vo.BuildVo;
import com.trkj.vo.FloorVo;
import com.trkj.vo.SickroomTypeVo;

@Controller
public class SickRoomController {
	@Autowired
	private SickroomService sts;
	@Autowired
	private BulidService bs;
	@Autowired
	
	/**
	 * 所有病房类型
	 * @return
	 */
	@RequestMapping("/to_QueryAllSickroonType")
	@ResponseBody
	public List<SickroomTypeVo> queryAllSickroonType(){
		return sts.queryAllSickroomType();
	}
	/**
	 * 动态查询病床
	 * @return
	 */
	@RequestMapping("/to_QueryBedManyIf")
	@ResponseBody
	public Map<String, Object> queryBedManyIf(String office,Long sickroomType,
					int page,int rows,String buildID, String floorID,String sex,String status){
		Map<String,Object> map = new HashMap<>();
		map.put("office", office);
		map.put("sickroomType", sickroomType);
		map.put("buildID", buildID);
		map.put("floorID", floorID);
		map.put("sex", sex);
		map.put("status", status);
		Map<String, Object> list = sts.findSickBedByManyIf(map,page,rows);
		return list;
	}
	/**
	 * 所有住院大楼
	 * @return
	 */
	@RequestMapping("/to_QueryAllLiveBuild")
	@ResponseBody
	public  List<BuildVo> queryAllLiveBuild(){
		return bs.queryAllLiveBuild();
	}
	/**
	 * 住院大楼对应的楼层
	 * @return
	 */
	@RequestMapping("/to_QueryFloors")
	@ResponseBody
	public List<FloorVo> queryFloors(String bid){
		return bs.queryUnderBuildFloors(bid);
	}
	/**
	 * 跳转病床选择窗口
	 * @return
	 */
	@RequestMapping("/to_selectSickRoomWindow")
	public String to_selectSickRoomWindow( ){
		return "hspt_live_bedquery";
		
	}
	/**
	 * 返回更换床位ID
	 * @return
	 */
	@RequestMapping("/to_createExchangeBedID")
	@ResponseBody
	public String exchangeBedID(){
		return sts.createExchangeBedID();
		
	}
	/**
	 * 更换床位
	 * @param exchangebedTable
	 * @return
	 */
	@RequestMapping("/to_AddnewExchange")
	@ResponseBody
	public boolean newExchange(ExchangebedTable exchangebedTable){
		return sts.newExchangeBed(exchangebedTable);
	}
	/**
	 * 打扫病床
	 * @return
	 */
	@RequestMapping("/to_sweepBed")
	@ResponseBody
	public boolean sweepBed(Long bid){
		return sts.sweepBed(bid);
	}
	/**
	 * 锁定病房
	 * @param bid
	 * @param status
	 * @return
	 */
	@RequestMapping("/to_lockBed")
	@ResponseBody
	public boolean lockBed(Long bid,String status){
		return sts.lockBed(bid, status);
	}
	/**
	 * 从病床查看病人信息
	 * @param bid
	 * @return
	 */
	@RequestMapping("/to_bookPatientInfoFromBed")
	@ResponseBody
	public Map<String,Object> bookPatientInfoFromBed(Integer bid){
		return sts.queryPatienInfoByBedID(bid);
		
	}
	/**
	 * 从床位查看病人
	 * @return
	 */
	@RequestMapping("/to_patientInfoFromBed")
	public String patientInfoFromBed(){
		return "live_in_bedPatientQuery";
	}
	/**
	 * 跳转病房管理界面
	 * @return
	 */
	@RequestMapping("/to_bed_manage")
	public String to_bed_query(){
		return "bed_query";
		
	}
	/**
	 * 跳转换床窗口
	 * @return
	 */
	@RequestMapping("/to_bed_exchange")
	public String to_bed_exchange( ){
		return "bed_exchange";
		
	}
	/**
	 * 跳转退房界面
	 * @return
	 */
	@RequestMapping("/to_bed_return")
	public String to_bed_return( ){
		return "bed_return";
		
	}

}
